<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 语法
        class People{
            constructor(user){
                this.user = user;
            }
            eat(food){
                console.log(this.user + "吃饭" + food);
            }
        }
        // 声明对象
        var mingda = new People("handsome");
        console.log(mingda.user);
        var dada = new People("ugly");
        dada.eat("粑粑");
    </script>
</body>
</html>